00001 00013 class OSGEventHandler : public osgGA::GUIEventHandler{ 00014 00015 DrawMode drawMode; // for the mode of the left-click menus 00016 osg::ref_ptr<osgProducer::Viewer> _viewer; //the viewer of the scene 00017 CMainFrame* frame; // the frame where the objects are selected and right-click is showed up 00018 TraffEduObject * dragObject; // the object in drag mode 00019 boolean defaultMouse; // whether the standdard mouse or handler events are called 00020 boolean rightMenu; //in rigthmenu mode 00021 00022 osg::Vec3 old_position; // for translation 00023 osg::Vec3 new_position; // for translation 00024 TraffEduObject *translatedObj; //the object being translated. 00025 public: 00026 00032 OSGEventHandler(osg::ref_ptr<osgProducer::Viewer> viewer, CMainFrame* newFrame): 00033 00034 _viewer(viewer) {frame= new CMainFrame(); frame=newFrame; defaultMouse=FALSE; rightMenu=false;} 00035 00039 ~OSGEventHandler() {} 00040 00047 bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& us); 00048 00053 void drawVehicleDodge(const osgGA::GUIEventAdapter& ea); 00054 00059 void drawVehicleSemi(const osgGA::GUIEventAdapter& ea); 00060 00065 void drawSign(const osgGA::GUIEventAdapter& ea); 00066 00071 void drawLight(const osgGA::GUIEventAdapter& ea); 00072 00077 void drawTree(const osgGA::GUIEventAdapter& ea); 00078 00083 void drawBuilding(const osgGA::GUIEventAdapter& ea); 00084 00089 void select(const osgGA::GUIEventAdapter& ea); 00090 00095 void roadPick (const osgGA::GUIEventAdapter& ea); 00096 00101 bool drawRoad(const osgGA::GUIEventAdapter& ea); 00102 00107 bool rightClickMenu(const osgGA::GUIEventAdapter& ea); 00108 00114 void drag(TraffEduObject * dragObject,const osgGA::GUIEventAdapter& ea); 00115 00120 void calculateNewPosition(const osgGA::GUIEventAdapter& ea); 00121 00126 void calculateOldPosition(const osgGA::GUIEventAdapter& ea); 00127 00128 };
1.4.6-NO